<?php
if( !defined( 'FORMFIELDRICHTEXT' ) ): define( 'FORMFIELDRICHTEXT', 1 );
if( !defined( 'FILE_ROOT' ) ) include_once( '../../_prerun' );

/**
 * CHAMP TEXTAREA RICH
 */
USE_LIB( 'formfieldtext' );

class FormFieldRichText extends FormFieldText
	{
	/**
	 * identifiant de classe de librairie Javascript
	 * @return string
	 */
	public function jsLibId()	
		{
		return( 'tinymce' );
		}

	/**
	 * code Javascript du controle
	 * @return string
	 */
	public function _getJavascript()	
		{
		$root = WWW_ROOT;
		$html=<<<HTML
			tinyMCE.init({
				mode : "specific_textareas",
				editor_selector : "mceTextSimple",
				plugins : "safari,xhtmlxtras",
				theme : "advanced",
				skin : "codesign",
				language : "fr",
				width:"99%",
        		debug : false,
        		convert_urls : false,
        		relative_urls : false,
				document_base_url : "{$root}",
				remove_script_host : false,

				cleanup_on_startup : true,
				inline_styles : false,
				convert_fonts_to_spans : false,
				force_br_newlines : false,
				force_p_newlines : true,
				apply_source_formatting : false,
				
				paste_create_paragraphs : true,
				paste_create_linebreaks : true,
				paste_remove_styles : true,
				paste_strip_class_attributes : 'all',
				paste_convert_middot_lists : false,
				paste_unindented_list_class : "unindentedList",
				paste_convert_headers_to_strong : false,
				paste_auto_cleanup_on_paste : true,
				invalid_elements : "span,font,div,strike,img",
				theme_advanced_buttons1 : "bold,italic,separator,bullist,numlist,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,link,unlink",
				theme_advanced_buttons2 : "",
				theme_advanced_buttons3 : "",
				theme_advanced_toolbar_location : "top",
				theme_advanced_toolbar_align : "left",
				theme_advanced_path_location : "none",
				extended_valid_elements : "a[name|href|target|title],p[style|align],div[style|align],strong,ul,li,ol,br,em"
			});
HTML;
		return( $html );
		}
		
		
		
		
	/**
	 * code Javascript du controle
	 * @return string
	 */
	public function _getJavascriptLib()	
		{
		$root = WWW_ROOT;
		$html=<<<HTML
		<script type="text/javascript" src="/scripts/tiny_mce/tiny_mce.js"></script>
HTML;
		return $html;
		}
	}
endif;
?>